<template>
  <YPage>
    <YNavBar :canBack="false" :title="nav_title"/>
    <YContent>
      <YColumn :is-match-height="true" :is-vertical-center="true">
        <button class="btn_title" @tap="btn_tap" :data-content="`您点击了：${store_btnTitle}`">{{ store_btnTitle }}</button>
      </YColumn>
    </YContent>
  </YPage>
</template>

<script>
import {mapMutations, mapState} from 'vuex'

let $this, yFree, IJkid, IFinal;

export default {
  onBackPress: () => yFree.yFinishApplication(),
  data() {
    return {
      nav_title: "",
    }
  },
  computed: mapState(['store_btnTitle']),
  methods: {
    ...mapMutations(["store_showBuilder"]),
    btn_tap: (e) => yFree.yToast(e.currentTarget.dataset.content),
  },
  onLoad(params) {
    $this = this, yFree = $this.yFree, IJkid = $this.MyApp.IJkid, IFinal = $this.MyApp.IFinal;
  },
  onReady() {
    $this.nav_title = yFree.webName;
    $this.store_showBuilder({
      page: $this,
      builderTitle: IFinal.builderTitle,
      toastTitle: IFinal.toastTitle,
    });
    yFree.yRegisterEvent((event, data) => {
      switch (event) {
        case "myFunc1":
          yFree.yToast("自定义扩展函数：myFunc1");
          break;
      }
    });
  },
}
</script>

<style scoped>
.btn_title {
  font-size: 20px;
  font-weight: bold;
  color: white;
  padding: 20px 50px;
}
</style>
